import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;

import java.util.Arrays;

public class c918 {
    public static void main(String[] args) {
        String name = "曹月蕊,王显博,范岳岩,付世发,李亚伦,候戈亿,康豪凯,李栋栋," +
                "李记风,李雨露,李昊琪,连明月,刘忠堂,娄育财,毛鑫,苗兴禹,聂鑫淼,师雯思,史稼豪,孙文轩," +
                "孙远猛,王晨菡,王路远,王文豪,王勇威,王雨宸,王紫新,王鑫冰,许润东,杨凯超,杨宗飞,袁硕鑫,张冰冰," +
                "张慧洁,魏富坤,张铭哲,张亚洲,张勇哲,张紫蓉,赵启奥,赵兴广,周露航,陈婧怡,权建业,杜光哲,杨振,郭依茂," +
                "吕令聪,张煜晗,刘浩展,李贯通，杨亚涵,杨振,于广玺,于江波,于满江,于深浩,于振业,袁煦展,张龙涛,张鹏博," +
                "张鹏璐,张志爽,张煜晗,赵燕妮,务铭坤,刘浩展,潘海洋,孙澳,李阳,孙润泽,孙晓静,唐嘉齐,王冰,王格,王梦姚," +
                "王梦璐,王爽楷,王硕,王亚宾,王淼,吴培瑶,许文娜,杨守卓,袁春彪,张颖,张兆宇,赵尚斌,周海涛,朱永豪,闫晴，安稳," +
                "范佳铭,冯盼龙,冯志鑫,冯,耿子凯,郭树豪,韩赛威,胡炳良,黄秋雨,姬浩航,姜丙埔,李晓芳,李要涛,李珂茹,梁轩瑜," +
                "刘浩琦,刘俊杰,刘相吾,刘运松,马明冻,潘鎵圣,孙属灵,王涵,王怀强,王林晴,王鹏程,王其琛,王秋格,王守盼,王越昔,魏忠南,邢桃桃," +
                "杨潞潞,赵发,赵广辉,赵佳歌,郑欣怡,郜江冉,窦柯豪,焦新雨,王亚坤,陈凯,陈骆凡,陈耀扬,陈宇航,杜宇轩,韩露晴,姜晓梦,蒋本州,李丹," +
                "李金涛,李冉,李帅,李宇梦,梁基行,梁琪,刘梦仙";
        String[] mingzi = name.split(",");
        System.out.println(Arrays.toString(mingzi));

        System.out.println(mingzi.length);


        String []xingshi = new String[mingzi.length];

        for (int i = 0; i < mingzi.length; i++) {
            System.out.println(mingzi[i].substring(0, 1));
            xingshi[i] = mingzi[i].substring(0,1);
        }

        System.out.println(Arrays.toString(xingshi));
        String[] xingshiArr = Arrays.stream(xingshi).distinct().toArray(String[]::new);
        System.out.println(Arrays.toString(xingshiArr));
        System.out.println(xingshiArr.length);

        for (int i = 0; i < xingshiArr.length; i++) {
                      int geshu = 0;
            for (int j = 0; j < xingshi.length; j++) {
                if (xingshiArr[i].equals(xingshi[j])){
                    geshu++;
                }
            }
            System.out.println("姓氏"+xingshiArr[i]+"有"+geshu+"个");
        }


    }
}